﻿#region Header
// Copyright 2007-2011, Jerónimo Milea
// 
// This file is part of NetJsWire.
// 
//     NetJsWire is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
// 
//     NetJsWire is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
// 
//     You should have received a copy of the GNU General Public License
//     along with NetJsWire.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System.Collections.Generic;
using System.ComponentModel;
using NetJsWire.Widgets.Core;
using NetJsWire.Widgets.Data;

namespace NetJsWire.Widgets.Config
{
    public partial interface IConfigOptions
    {
        [DefaultValue( false )]
        [Description( "Defaults to true causing the store to automatically save records to the server when a record is modified" )]
        bool AutoSave { get; set; }

        [Description( "An object containing properties which are to be sent as parameters for every HTTP request." )]
        [DefaultValue( null )]
        List<BaseParam> BaseParams { get; set; }

        [DefaultValue( false )]
        [Description( "Defaults to true (unless restful==true). Multiple requests for each CRUD action (CREATE, READ, UPDATE and DESTROY) will be combined and sent as one transaction.\nOnly applies when autoSave is set to false." )]
        bool Batch { get; set; }

        [Description( "Provides the default values for the paramNames property.\nTo globally modify the parameters for all stores, this object should be changed on the store prototype." )]
        [DefaultValue( ( string ) null )]
        ParamNames DefaultParamNames { get; set; }

        [Description( "A config object containing one or more event handlers to be added to this object during initialization." )]
        [DefaultValue( null )]
        List<Listener> Listeners { get; set; }

        [Description( "An object containing properties which specify the names of the paging and sorting parameters passed to remote servers when loading blocks of data." )]
        [DefaultValue( null )]
        ParamNames ParamNames { get; set; }

        [Description( "The DataProxy object which provides access to a data object." )]
        [DefaultValue( null )]
        DataProxy Proxy { get; set; }

        [Description( "true to clear all modified record information each time the store is loaded or when a record is removed (defaults to false)." )]
        [DefaultValue( false )]
        bool PruneModifiedRecords { get; set; }

        [Description( "The Reader object which processes the data object and returns an Array of Ext.data.Record objects which are cached keyed by their id property." )]
        [DefaultValue( null )]
        DataReader Reader { get; set; }

        [Description( "true if sorting is to be handled by requesting the Proxy to provide a refreshed version of the data object in sorted order, as opposed to sorting the Record cache in place (defaults to false)." )]
        [DefaultValue( false )]
        bool RemoteSort { get; set; }

        [Description( "Defaults to false. Set to true to have the Store and the set Proxy operate in a RESTful manner." )]
        [DefaultValue( false )]
        bool RestFul { get; set; }

        [Description( "Defaults to false. Set to a config object to specify the sort order in the request of a Store's load operation. Note that for local sorting, the direction property is case-sensitive." )]
        [DefaultValue( null )]
        SortInfo SortInfo { get; set; }

        [Description( "If passed, the id to use to register with the StoreMgr." )]
        [DefaultValue( ( string ) null )]
        string StoreId { get; set; }

        [Description( "If a proxy is not specified the url will be used to implicitly configure a HttpProxy if an url is specified." )]
        [DefaultValue( ( string ) null )]
        string Url { get; set; }

        [Description( "The Writer object which processes a record object for being written to the server-side database." )]
        [DefaultValue( null )]
        DataWriter Writer { get; set; }

        #region ArrayStore

        [DefaultValue( 0 )]
        int IdIndex { get; set; }

        #endregion

        #region JsonStore

        [Description( "[id] Name of the property within a row object that contains a record identifier value. Defaults to id" )]
        [DefaultValue( null )]
        string IdProperty { get; set; }

        [Description( "[undefined] Required. The name of the property which contains the Array of row objects. Defaults to undefined. An exception will be thrown if the root property is undefined." )]
        [DefaultValue( null )]
        string Root { get; set; }

        [Description( "[undefined] Required. The name of the property which contains the Array of row objects. Defaults to undefined. An exception will be thrown if the root property is undefined." )]
        [DefaultValue( null )]
        string SuccessProperty { get; set; }

        [Description( "[total] Name of the property from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server. Defaults to total." )]
        [DefaultValue( null )]
        string TotalProperty { get; set; }

        #endregion
    }
}
